home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qpen.h.z / qpen.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.1 KB  |  80 lines

  1. /****************************************************************************
  2. ** $Id: qpen.h,v 2.4 1998/07/03 00:09:37 hanord Exp $
  3. **
  4. ** Definition of QPen class
  5. **
  6. ** Created : 940112
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QPEN_H
  25. #define QPEN_H
  26.  
  27. #ifndef QT_H
  28. #include "qcolor.h"
  29. #include "qshared.h"
  30. #endif // QT_H
  31.  
  32.  
  33. enum PenStyle { NoPen, SolidLine, DashLine,    // pen style
  34.         DotLine, DashDotLine, DashDotDotLine };
  35.  
  36.  
  37. class QPen
  38. {
  39. friend class QPainter;
  40. public:
  41.     QPen();
  42.     QPen( PenStyle );
  43.     QPen( const QColor &color, uint width=0, PenStyle style=SolidLine );
  44.     QPen( const QPen & );
  45.    ~QPen();
  46.     QPen &operator=( const QPen & );
  47.  
  48.     PenStyle    style() const        { return data->style; }
  49.     void    setStyle( PenStyle );
  50.     uint    width() const        { return data->width; }
  51.     void    setWidth( uint );
  52.     const QColor &color() const        { return data->color; }
  53.     void    setColor( const QColor & );
  54.  
  55.     bool    operator==( const QPen &p ) const;
  56.     bool    operator!=( const QPen &p ) const
  57.                     { return !(operator==(p)); }
  58.  
  59. private:
  60.     QPen    copy()    const;
  61.     void    detach();
  62.     void    init( const QColor &, uint, PenStyle );
  63.     struct QPenData : public QShared {        // pen data
  64.     PenStyle  style;
  65.     uint      width;
  66.     QColor      color;
  67.     } *data;
  68. };
  69.  
  70.  
  71. /*****************************************************************************
  72.   QPen stream functions
  73.  *****************************************************************************/
  74.  
  75. QDataStream &operator<<( QDataStream &, const QPen & );
  76. QDataStream &operator>>( QDataStream &, QPen & );
  77.  
  78.  
  79. #endif // QPEN_H
  80.